pam.cxx (efeef26f) pam.cxx (23d8f725)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 657 unchanged lines hidden (view full) ---

666 }
667
668 return pRet;
669}
670// <--
671
672// steht in etwas geschuetztem oder in die Selektion umspannt
673// etwas geschuetztes.
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 657 unchanged lines hidden (view full) ---

666 }
667
668 return pRet;
669}
670// <--
671
672// steht in etwas geschuetztem oder in die Selektion umspannt
673// etwas geschuetztes.
674sal_Bool SwPaM::HasReadonlySel( bool bFormView ) const
674sal_Bool SwPaM::HasReadonlySel( const bool bFormView ) const
675{
676 sal_Bool bRet = sal_False;
675{
676 sal_Bool bRet = sal_False;
677 Point aTmpPt;
678 const SwCntntNode *pNd;
679 const SwCntntFrm *pFrm;
680
677
681 if( 0 != ( pNd = GetPoint()->nNode.GetNode().GetCntntNode() ))
678 const SwCntntNode* pNd = GetPoint()->nNode.GetNode().GetCntntNode();
679 const SwCntntFrm *pFrm = NULL;
680 if ( pNd != NULL )
681 {
682 Point aTmpPt;
682 pFrm = pNd->getLayoutFrm( pNd->GetDoc()->GetCurrentLayout(), &aTmpPt, GetPoint(), sal_False );
683 pFrm = pNd->getLayoutFrm( pNd->GetDoc()->GetCurrentLayout(), &aTmpPt, GetPoint(), sal_False );
683 else
684 pFrm = 0;
684 }
685
685
686 // --> FME 2004-06-29 #114856# Formular view
687 // Will be set if point/mark are inside edit-in-readonly environment
688 const SwFrm* pSttEIRFrm = 0;
689 const SwFrm* pEndEIRFrm = 0;
690
691 if( pFrm && ( pFrm->IsProtected() ||
692 // --> FME 2004-06-29 #114856# Formular view
693 ( bFormView &&
694 0 == ( pSttEIRFrm = lcl_FindEditInReadonlyFrm( *pFrm ) ) ) ) )
695 // <--
686 // Will be set if point are inside edit-in-readonly environment
687 const SwFrm* pPointEditInReadonlyFrm = NULL;
688 if ( pFrm != NULL
689 && ( pFrm->IsProtected()
690 || ( bFormView
691 && 0 == ( pPointEditInReadonlyFrm = lcl_FindEditInReadonlyFrm( *pFrm ) ) ) ) )
692 {
696 bRet = sal_True;
693 bRet = sal_True;
697 else if( pNd )
694 }
695 else if( pNd != NULL )
698 {
699 const SwSectionNode* pSNd = pNd->GetSectionNode();
696 {
697 const SwSectionNode* pSNd = pNd->GetSectionNode();
700 if( pSNd && ( pSNd->GetSection().IsProtectFlag() ||
701 // --> FME 2004-06-29 #114856# Formular view
702 (bFormView && !pSNd->GetSection().IsEditInReadonlyFlag()) ) )
703 // <--
698 if ( pSNd != NULL
699 && ( pSNd->GetSection().IsProtectFlag()
700 || ( bFormView
701 && !pSNd->GetSection().IsEditInReadonlyFlag()) ) )
702 {
704 bRet = sal_True;
703 bRet = sal_True;
704 }
705 }
706
705 }
706
707 if( !bRet && HasMark() && GetPoint()->nNode != GetMark()->nNode )
707 if ( !bRet
708 && HasMark()
709 && GetPoint()->nNode != GetMark()->nNode )
708 {
710 {
709 if( 0 != ( pNd = GetMark()->nNode.GetNode().GetCntntNode() ))
711 pNd = GetMark()->nNode.GetNode().GetCntntNode();
712 pFrm = NULL;
713 if ( pNd != NULL )
714 {
715 Point aTmpPt;
710 pFrm = pNd->getLayoutFrm( pNd->GetDoc()->GetCurrentLayout(), &aTmpPt, GetMark(), sal_False );
716 pFrm = pNd->getLayoutFrm( pNd->GetDoc()->GetCurrentLayout(), &aTmpPt, GetMark(), sal_False );
711 else
712 pFrm = 0;
717 }
713
718
714 if( pFrm && ( pFrm->IsProtected() ||
715 // --> FME 2004-06-29 #114856# Formular view
716 ( bFormView &&
717 0 == ( pEndEIRFrm = lcl_FindEditInReadonlyFrm( *pFrm ) ) ) ) )
718 // <--
719 const SwFrm* pMarkEditInReadonlyFrm = NULL;
720 if ( pFrm != NULL
721 && ( pFrm->IsProtected()
722 || ( bFormView
723 && 0 == ( pMarkEditInReadonlyFrm = lcl_FindEditInReadonlyFrm( *pFrm ) ) ) ) )
724 {
719 bRet = sal_True;
725 bRet = sal_True;
720 else if( pNd )
726 }
727 else if( pNd != NULL )
721 {
722 const SwSectionNode* pSNd = pNd->GetSectionNode();
728 {
729 const SwSectionNode* pSNd = pNd->GetSectionNode();
723 if( pSNd && ( pSNd->GetSection().IsProtectFlag() ||
724 // --> FME 2004-06-29 #114856# Formular view
725 (bFormView && !pSNd->GetSection().IsEditInReadonlyFlag()) ) )
726 // <--
730 if ( pSNd != NULL
731 && ( pSNd->GetSection().IsProtectFlag()
732 || ( bFormView
733 && !pSNd->GetSection().IsEditInReadonlyFlag()) ) )
734 {
727 bRet = sal_True;
735 bRet = sal_True;
736 }
728 }
729
737 }
738
730 // --> FME 2004-06-29 #114856# Formular view
731 if ( !bRet && bFormView )
732 {
733 // Check if start and end frame are inside the _same_
734 // edit-in-readonly-environment. Otherwise we better return 'true'
739 if ( !bRet && bFormView )
740 {
741 // Check if start and end frame are inside the _same_
742 // edit-in-readonly-environment. Otherwise we better return 'true'
735 if ( pSttEIRFrm != pEndEIRFrm )
743 if ( pPointEditInReadonlyFrm != pMarkEditInReadonlyFrm )
736 bRet = sal_True;
737 }
744 bRet = sal_True;
745 }
738 // <--
739
746
740 // oder sollte eine geschuetzte Section innerhalb der
741 // Selektion liegen?
747 // check for protected section inside the selection
742 if( !bRet )
743 {
744 sal_uLong nSttIdx = GetMark()->nNode.GetIndex(),
745 nEndIdx = GetPoint()->nNode.GetIndex();
746 if( nEndIdx <= nSttIdx )
747 {
748 sal_uLong nTmp = nSttIdx;
749 nSttIdx = nEndIdx;

--- 12 unchanged lines hidden (view full) ---

762 if( pFmt->GetProtect().IsCntntProtected() )
763 {
764 const SwFmtCntnt& rCntnt = pFmt->GetCntnt(sal_False);
765 ASSERT( rCntnt.GetCntntIdx(), "wo ist der SectionNode?" );
766 sal_uLong nIdx = rCntnt.GetCntntIdx()->GetIndex();
767 if( nSttIdx <= nIdx && nEndIdx >= nIdx &&
768 rCntnt.GetCntntIdx()->GetNode().GetNodes().IsDocNodes() )
769 {
748 if( !bRet )
749 {
750 sal_uLong nSttIdx = GetMark()->nNode.GetIndex(),
751 nEndIdx = GetPoint()->nNode.GetIndex();
752 if( nEndIdx <= nSttIdx )
753 {
754 sal_uLong nTmp = nSttIdx;
755 nSttIdx = nEndIdx;

--- 12 unchanged lines hidden (view full) ---

768 if( pFmt->GetProtect().IsCntntProtected() )
769 {
770 const SwFmtCntnt& rCntnt = pFmt->GetCntnt(sal_False);
771 ASSERT( rCntnt.GetCntntIdx(), "wo ist der SectionNode?" );
772 sal_uLong nIdx = rCntnt.GetCntntIdx()->GetIndex();
773 if( nSttIdx <= nIdx && nEndIdx >= nIdx &&
774 rCntnt.GetCntntIdx()->GetNode().GetNodes().IsDocNodes() )
775 {
770/* // ist es keine gelinkte Section, dann kann sie auch
771 // nicht mitselektiert werden
772 const SwSection& rSect = *pFmt->GetSection();
773 if( CONTENT_SECTION == rSect.GetType() )
774 {
775 RestoreSavePos();
776 return sal_True;
777 }
778*/
779 bRet = sal_True;
780 break;
781 }
782 }
783 }
784
785#ifdef CHECK_CELL_READONLY
786//JP 22.01.99: bisher wurden Tabelle, die in der Text-Selektion standen

--- 27 unchanged lines hidden (view full) ---

814 break;
815 }
816 }
817 }
818#endif
819 }
820 }
821 }
776 bRet = sal_True;
777 break;
778 }
779 }
780 }
781
782#ifdef CHECK_CELL_READONLY
783//JP 22.01.99: bisher wurden Tabelle, die in der Text-Selektion standen

--- 27 unchanged lines hidden (view full) ---

811 break;
812 }
813 }
814 }
815#endif
816 }
817 }
818 }
819
822 //FIXME FieldBk
823 // TODO: Form Protection when Enhanced Fields are enabled
820 //FIXME FieldBk
821 // TODO: Form Protection when Enhanced Fields are enabled
824 if (!bRet) {
822 if (!bRet)
823 {
825 const SwDoc *pDoc = GetDoc();
826 sw::mark::IMark* pA = NULL;
827 sw::mark::IMark* pB = NULL;
828 if ( pDoc )
829 {
830 const IDocumentMarkAccess* pMarksAccess = pDoc->getIDocumentMarkAccess( );
831 pA = GetPoint() ? pMarksAccess->getFieldmarkFor( *GetPoint( ) ) : NULL;
832 pB = GetMark( ) ? pMarksAccess->getFieldmarkFor( *GetMark( ) ) : pA;
833 bRet = ( pA != pB );
834 }
835 bool bProtectForm = pDoc->get( IDocumentSettingAccess::PROTECT_FORM );
836 if ( bProtectForm )
837 bRet |= ( pA == NULL || pB == NULL );
838 }
824 const SwDoc *pDoc = GetDoc();
825 sw::mark::IMark* pA = NULL;
826 sw::mark::IMark* pB = NULL;
827 if ( pDoc )
828 {
829 const IDocumentMarkAccess* pMarksAccess = pDoc->getIDocumentMarkAccess( );
830 pA = GetPoint() ? pMarksAccess->getFieldmarkFor( *GetPoint( ) ) : NULL;
831 pB = GetMark( ) ? pMarksAccess->getFieldmarkFor( *GetMark( ) ) : pA;
832 bRet = ( pA != pB );
833 }
834 bool bProtectForm = pDoc->get( IDocumentSettingAccess::PROTECT_FORM );
835 if ( bProtectForm )
836 bRet |= ( pA == NULL || pB == NULL );
837 }
838
839 return bRet;
840}
841
842//-------------------- Suche nach Formaten( FormatNamen ) -----------------
843
844// die Funktion gibt in Suchrichtung den folgenden Node zurueck.
845// Ist in der Richtung keiner mehr vorhanden oder ist dieser ausserhalb
846// des Bereiches, wird ein 0 Pointer returnt.

--- 396 unchanged lines hidden ---
839 return bRet;
840}
841
842//-------------------- Suche nach Formaten( FormatNamen ) -----------------
843
844// die Funktion gibt in Suchrichtung den folgenden Node zurueck.
845// Ist in der Richtung keiner mehr vorhanden oder ist dieser ausserhalb
846// des Bereiches, wird ein 0 Pointer returnt.

--- 396 unchanged lines hidden ---