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 : DBG_NAME(SdrOutliner)
29 :
30 13244 : SdrOutliner::SdrOutliner( SfxItemPool* pItemPool, sal_uInt16 nMode )
31 : : Outliner( pItemPool, nMode ),
32 : //mpPaintInfoRec( NULL )
33 13244 : mpVisualizedPage(0)
34 : {
35 : DBG_CTOR(SdrOutliner,NULL);
36 13244 : }
37 :
38 :
39 26327 : SdrOutliner::~SdrOutliner()
40 : {
41 : DBG_DTOR(SdrOutliner,NULL);
42 26327 : }
43 :
44 :
45 410744 : void SdrOutliner::SetTextObj( const SdrTextObj* pObj )
46 : {
47 410744 : if( pObj && pObj != mpTextObj.get() )
48 : {
49 64785 : SetUpdateMode(sal_False);
50 64785 : sal_uInt16 nOutlinerMode2 = OUTLINERMODE_OUTLINEOBJECT;
51 64785 : if ( !pObj->IsOutlText() )
52 64305 : nOutlinerMode2 = OUTLINERMODE_TEXTOBJECT;
53 64785 : Init( nOutlinerMode2 );
54 :
55 64785 : SetGlobalCharStretching(100,100);
56 :
57 64785 : sal_uIntPtr nStat = GetControlWord();
58 64785 : nStat &= ~( EE_CNTRL_STRETCHING | EE_CNTRL_AUTOPAGESIZE );
59 64785 : SetControlWord(nStat);
60 :
61 64785 : Size aNullSize;
62 64785 : Size aMaxSize( 100000,100000 );
63 64785 : SetMinAutoPaperSize( aNullSize );
64 64785 : SetMaxAutoPaperSize( aMaxSize );
65 64785 : SetPaperSize( aMaxSize );
66 64785 : ClearPolygon();
67 : }
68 :
69 410744 : mpTextObj.reset( const_cast< SdrTextObj* >(pObj) );
70 410744 : }
71 :
72 12351 : void SdrOutliner::SetTextObjNoInit( const SdrTextObj* pObj )
73 : {
74 12351 : mpTextObj.reset( const_cast< SdrTextObj* >(pObj) );
75 12351 : }
76 :
77 1466 : OUString SdrOutliner::CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, sal_uInt16 nPos,
78 : Color*& rpTxtColor, Color*& rpFldColor)
79 : {
80 1466 : bool bOk = false;
81 1466 : XubString aRet;
82 :
83 1466 : if(mpTextObj.is())
84 1445 : bOk = static_cast< SdrTextObj* >( mpTextObj.get())->CalcFieldValue(rField, nPara, nPos, sal_False, rpTxtColor, rpFldColor, aRet);
85 :
86 1466 : if (!bOk)
87 1382 : aRet = Outliner::CalcFieldValue(rField, nPara, nPos, rpTxtColor, rpFldColor);
88 :
89 1466 : return aRet;
90 : }
91 :
92 69555 : const SdrTextObj* SdrOutliner::GetTextObj() const
93 : {
94 69555 : if( mpTextObj.is() )
95 1670 : return static_cast< SdrTextObj* >( mpTextObj.get() );
96 : else
97 67885 : return 0;
98 258 : }
99 :
100 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|