1 /*
2 * Copyright (c) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include "utils/document.h"
17
18 #include "impl_factory.h"
19 #include "static_factory.h"
20
21 namespace OHOS {
22 namespace Rosen {
23 namespace Drawing {
24
Document(std::shared_ptr<DocumentImpl> documentImpl)25 Document::Document(std::shared_ptr<DocumentImpl> documentImpl) noexcept : documentImplPtr_(documentImpl) {}
26
BeginPage(float width,float height)27 std::shared_ptr<Canvas> Document::BeginPage(float width, float height)
28 {
29 if (documentImplPtr_ == nullptr) {
30 return nullptr;
31 }
32 return documentImplPtr_->BeginPage(width, height);
33 }
34
EndPage()35 void Document::EndPage()
36 {
37 if (documentImplPtr_ == nullptr) {
38 return;
39 }
40 documentImplPtr_->EndPage();
41 }
42
MakeMultiPictureDocument(FileWStream * fileStream,SerialProcs * procs,std::unique_ptr<SharingSerialContext> & serialContext)43 std::shared_ptr<Document> Document::MakeMultiPictureDocument(FileWStream* fileStream,
44 SerialProcs* procs, std::unique_ptr<SharingSerialContext>& serialContext)
45 {
46 return StaticFactory::MakeMultiPictureDocument(fileStream, procs, serialContext);
47 }
48
Close()49 void Document::Close()
50 {
51 if (documentImplPtr_ == nullptr) {
52 return;
53 }
54 documentImplPtr_->Close();
55 }
56 } // namespace Drawing
57 } // namespace Rosen
58 } // namespace OHOS
59