1 /* 2 * Copyright (c) 2022 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 #ifndef PRINT_PREVIEW_ATTRIBUTE_H 16 #define PRINT_PREVIEW_ATTRIBUTE_H 17 18 #include "parcel.h" 19 #include "print_range.h" 20 21 namespace OHOS::Print { 22 class PrintPreviewAttribute final : public Parcelable { 23 public: 24 explicit PrintPreviewAttribute(); 25 26 PrintPreviewAttribute(const PrintPreviewAttribute &right); 27 28 PrintPreviewAttribute &operator=(const PrintPreviewAttribute &PrintPreviewAttribute); 29 30 virtual ~PrintPreviewAttribute(); 31 32 void Reset(); 33 34 [[nodiscard]] bool HasResult() const; 35 36 [[nodiscard]] uint32_t GetResult() const; 37 38 void GetPreviewRange(PrintRange &previewRange) const; 39 40 void SetResult(uint32_t result); 41 42 void SetPreviewRange(const PrintRange &previewRange); 43 44 virtual bool Marshalling(Parcel &parcel) const override; 45 46 static std::shared_ptr<PrintPreviewAttribute> Unmarshalling(Parcel &parcel); 47 48 void Dump(); 49 50 private: 51 void ReadFromParcel(Parcel &parcel); 52 53 private: 54 bool hasResult_; 55 uint32_t result_; 56 PrintRange previewRange_; 57 }; 58 } // namespace OHOS::Print 59 #endif // PRINT_PREVIEW_ATTRIBUTE_H 60