1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "tp_TitleRotation.hxx"
23 #include "ResourceIds.hrc"
24 #include "chartview/ChartSfxItemIds.hxx"
25 #include "HelpIds.hrc"
27 #include <editeng/eeitem.hxx>
28 #include <editeng/frmdiritem.hxx>
29 #include <svl/intitem.hxx>
34 SchAlignmentTabPage::SchAlignmentTabPage(vcl::Window
* pWindow
,
35 const SfxItemSet
& rInAttrs
, bool bWithRotation
) :
36 SfxTabPage(pWindow
, "TitleRotationTabPage","modules/schart/ui/titlerotationtabpage.ui", &rInAttrs
)
38 get(m_pCtrlDial
,"dialCtrl");
39 get(m_pFtRotate
,"degreeL");
40 get(m_pNfRotate
,"OrientDegree");
41 get(m_pCbStacked
,"stackedCB");
42 get(m_pFtTextDirection
,"textdirL");
43 get(m_pLbTextDirection
,"textdirLB");
44 get(m_pFtABCD
,"labelABCD");
45 m_pCtrlDial
->SetText(m_pFtABCD
->GetText());
46 m_pOrientHlp
= new svx::OrientationHelper(*m_pCtrlDial
, *m_pNfRotate
, *m_pCbStacked
);
48 m_pCbStacked
->EnableTriState( false );
49 m_pOrientHlp
->Enable( true );
50 m_pOrientHlp
->AddDependentWindow( *m_pFtRotate
, TRISTATE_TRUE
);
58 SchAlignmentTabPage::~SchAlignmentTabPage()
63 void SchAlignmentTabPage::dispose()
71 m_pFtTextDirection
.clear();
72 m_pLbTextDirection
.clear();
74 SfxTabPage::dispose();
77 VclPtr
<SfxTabPage
> SchAlignmentTabPage::Create(vcl::Window
* pParent
,
78 const SfxItemSet
* rInAttrs
)
80 return VclPtr
<SchAlignmentTabPage
>::Create(pParent
, *rInAttrs
);
83 VclPtr
<SfxTabPage
> SchAlignmentTabPage::CreateWithoutRotation(vcl::Window
* pParent
,
84 const SfxItemSet
* rInAttrs
)
86 return VclPtr
<SchAlignmentTabPage
>::Create(pParent
, *rInAttrs
, false);
89 bool SchAlignmentTabPage::FillItemSet(SfxItemSet
* rOutAttrs
)
91 //Since 04/1998 text can be rotated by an arbitrary angle: SCHATTR_TEXT_DEGREES
92 bool bStacked
= m_pOrientHlp
->GetStackedState() == TRISTATE_TRUE
;
93 rOutAttrs
->Put( SfxBoolItem( SCHATTR_TEXT_STACKED
, bStacked
) );
95 sal_Int32 nDegrees
= bStacked
? 0 : m_pCtrlDial
->GetRotation();
96 rOutAttrs
->Put( SfxInt32Item( SCHATTR_TEXT_DEGREES
, nDegrees
) );
98 SvxFrameDirection
aDirection( m_pLbTextDirection
->GetSelectEntryValue() );
99 rOutAttrs
->Put( SvxFrameDirectionItem( aDirection
, EE_PARA_WRITINGDIR
) );
104 void SchAlignmentTabPage::Reset(const SfxItemSet
* rInAttrs
)
106 const SfxPoolItem
* pItem
= GetItem( *rInAttrs
, SCHATTR_TEXT_DEGREES
);
108 sal_Int32 nDegrees
= pItem
? static_cast<const SfxInt32Item
*>(pItem
)->GetValue() : 0;
109 m_pCtrlDial
->SetRotation( nDegrees
);
111 pItem
= GetItem( *rInAttrs
, SCHATTR_TEXT_STACKED
);
112 bool bStacked
= pItem
&& static_cast<const SfxBoolItem
*>(pItem
)->GetValue();
113 m_pOrientHlp
->SetStackedState( bStacked
? TRISTATE_TRUE
: TRISTATE_FALSE
);
115 if( rInAttrs
->GetItemState(EE_PARA_WRITINGDIR
, true, &pItem
) == SfxItemState::SET
)
116 m_pLbTextDirection
->SelectEntryValue( SvxFrameDirection(static_cast<const SvxFrameDirectionItem
*>(pItem
)->GetValue()) );
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */