Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <svx/svdoutl.hxx>
21 : #include <editeng/outliner.hxx>
22 : #include <svx/svdotext.hxx>
23 : #include <editeng/editstat.hxx>
24 : #include <svx/svdmodel.hxx>
25 : #include <editeng/eeitem.hxx>
26 : #include <svl/itempool.hxx>
27 :
28 :
29 18833 : SdrOutliner::SdrOutliner( SfxItemPool* pItemPool, sal_uInt16 nMode )
30 : : Outliner( pItemPool, nMode ),
31 : //mpPaintInfoRec( NULL )
32 18833 : mpVisualizedPage(0)
33 : {
34 18833 : }
35 :
36 :
37 34184 : SdrOutliner::~SdrOutliner()
38 : {
39 34184 : }
40 :
41 :
42 429229 : void SdrOutliner::SetTextObj( const SdrTextObj* pObj )
43 : {
44 429229 : if( pObj && pObj != mpTextObj.get() )
45 : {
46 79241 : SetUpdateMode(false);
47 79241 : sal_uInt16 nOutlinerMode2 = OUTLINERMODE_OUTLINEOBJECT;
48 79241 : if ( !pObj->IsOutlText() )
49 78281 : nOutlinerMode2 = OUTLINERMODE_TEXTOBJECT;
50 79241 : Init( nOutlinerMode2 );
51 :
52 79241 : SetGlobalCharStretching(100,100);
53 :
54 79241 : sal_uIntPtr nStat = GetControlWord();
55 79241 : nStat &= ~( EE_CNTRL_STRETCHING | EE_CNTRL_AUTOPAGESIZE );
56 79241 : SetControlWord(nStat);
57 :
58 79241 : Size aNullSize;
59 79241 : Size aMaxSize( 100000,100000 );
60 79241 : SetMinAutoPaperSize( aNullSize );
61 79241 : SetMaxAutoPaperSize( aMaxSize );
62 79241 : SetPaperSize( aMaxSize );
63 79241 : ClearPolygon();
64 : }
65 :
66 429229 : mpTextObj.reset( const_cast< SdrTextObj* >(pObj) );
67 429229 : }
68 :
69 16173 : void SdrOutliner::SetTextObjNoInit( const SdrTextObj* pObj )
70 : {
71 16173 : mpTextObj.reset( const_cast< SdrTextObj* >(pObj) );
72 16173 : }
73 :
74 3536 : OUString SdrOutliner::CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos,
75 : Color*& rpTxtColor, Color*& rpFldColor)
76 : {
77 3536 : bool bOk = false;
78 3536 : OUString aRet;
79 :
80 3536 : if(mpTextObj.is())
81 3442 : bOk = static_cast< SdrTextObj* >( mpTextObj.get())->CalcFieldValue(rField, nPara, nPos, false, rpTxtColor, rpFldColor, aRet);
82 :
83 3536 : if (!bOk)
84 3452 : aRet = Outliner::CalcFieldValue(rField, nPara, nPos, rpTxtColor, rpFldColor);
85 :
86 3536 : return aRet;
87 : }
88 :
89 104530 : const SdrTextObj* SdrOutliner::GetTextObj() const
90 : {
91 104530 : if( mpTextObj.is() )
92 3816 : return static_cast< SdrTextObj* >( mpTextObj.get() );
93 : else
94 100714 : return 0;
95 : }
96 :
97 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|